package com.wss.common.widget;

import ohos.agp.components.AttrSet;
import ohos.agp.components.Component;
import ohos.agp.components.DragEvent;
import ohos.agp.components.PageSlider;
import ohos.app.Context;

public class NoScrollViewPager extends PageSlider {

    private boolean noScroll = false;

    public NoScrollViewPager(Context context) {
        super(context);
    }

    public NoScrollViewPager(Context context, AttrSet attrSet) {
        super(context, attrSet);
    }

    public NoScrollViewPager(Context context, AttrSet attrSet, String styleName) {
        super(context, attrSet, styleName);
    }

    @Override
    public void scrollTo(int x, int y) {
        super.scrollTo(x, y);
    }

    @Override
    public void setCurrentPage(int itemPos, boolean smoothScroll) {
        super.setCurrentPage(itemPos, smoothScroll);
    }

    @Override
    public void setCurrentPage(int itemPos) {
        super.setCurrentPage(itemPos);
    }

    @Override
    public boolean onDrag(Component component, DragEvent event) {
        return !noScroll && super.onDrag(component, event);
    }
}
